{	Problem: http://codeforces.ru/problemset/problem/6/A
 	Verdict: Accepted
}
var a,b,c,d:longint; m:array[1..4] of byte;
function check(a,b,c:longint):byte;
begin
if (a<b+c) and (b<a+c) and (c<a+b) then result:=0 else
if (a+b=c) or (a+c=b) or (c+b=a) then result:=1 else result:=2;
end;
begin
read(a,b,c,d);
fillchar(m,sizeof(m),0);
m[1]:=check(a,b,c);
m[2]:=check(a,b,d);
m[3]:=check(a,c,d);
m[4]:=check(b,c,d);
if (m[1]=0) or (m[2]=0) or (m[3]=0) or (m[4]=0) then write('TRIANGLE') else
if (m[1]=1) or (m[2]=1) or (m[3]=1) or (m[4]=1) then write('SEGMENT') else write('IMPOSSIBLE');
end.